package com.dgshanger.sanhxiaofeisc.common;


import com.blankj.utilcode.util.NetworkUtils;
import com.dgshanger.sanhxiaofeisc.common.interceptor.TokenInterceptor;
import com.dgshanger.sanhxiaofeisc.entity.BillEntity;
import com.dgshanger.sanhxiaofeisc.entity.CategoryItemEntity;
import com.dgshanger.sanhxiaofeisc.entity.CheckPwdEntity;
import com.dgshanger.sanhxiaofeisc.entity.CodePaySettingEntity;
import com.dgshanger.sanhxiaofeisc.entity.CommentDetailsEntity;
import com.dgshanger.sanhxiaofeisc.entity.CommentListEntity;
import com.dgshanger.sanhxiaofeisc.entity.CustomServerEntity;
import com.dgshanger.sanhxiaofeisc.entity.FilePathEntity;
import com.dgshanger.sanhxiaofeisc.entity.GoodsDetailsEntity;
import com.dgshanger.sanhxiaofeisc.entity.HistoryPaidEntity;
import com.dgshanger.sanhxiaofeisc.entity.HomeEntity;
import com.dgshanger.sanhxiaofeisc.entity.InvoiceEntity;
import com.dgshanger.sanhxiaofeisc.entity.LoginEntity;
import com.dgshanger.sanhxiaofeisc.entity.LoosePaymentEntity;
import com.dgshanger.sanhxiaofeisc.entity.MemberShipCardEntity;
import com.dgshanger.sanhxiaofeisc.entity.MerchantEntity;
import com.dgshanger.sanhxiaofeisc.entity.MessageEntity;
import com.dgshanger.sanhxiaofeisc.entity.MyTeamEntity;
import com.dgshanger.sanhxiaofeisc.entity.NearbyItemEntity;
import com.dgshanger.sanhxiaofeisc.entity.PayForDetailEntity;
import com.dgshanger.sanhxiaofeisc.entity.PayResultEntity;
import com.dgshanger.sanhxiaofeisc.entity.PaymentCodeEntity;
import com.dgshanger.sanhxiaofeisc.entity.PictureEntity;
import com.dgshanger.sanhxiaofeisc.entity.PromoteRankingEntity;
import com.dgshanger.sanhxiaofeisc.entity.PurseEntity;
import com.dgshanger.sanhxiaofeisc.entity.RegisterEntity;
import com.dgshanger.sanhxiaofeisc.entity.SearchHotEntity;
import com.dgshanger.sanhxiaofeisc.entity.ShareEntity;
import com.dgshanger.sanhxiaofeisc.entity.ShopDetailsEntity;
import com.dgshanger.sanhxiaofeisc.entity.ShopEnterEntity;
import com.dgshanger.sanhxiaofeisc.entity.ShopGoodsItemEntity;
import com.dgshanger.sanhxiaofeisc.entity.ShoppingVideoEntity;
import com.dgshanger.sanhxiaofeisc.entity.TransferAccountsEntity;
import com.dgshanger.sanhxiaofeisc.entity.UserEntity;
import com.dgshanger.sanhxiaofeisc.entity.VipDetailEntity;
import com.dgshanger.sanhxiaofeisc.entity.VipEntity;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import com.xx.baseutilslibrary.network.entity.BaseResponseEntity;
import com.xx.baseutilslibrary.network.retrofit.Retrofit2Manager;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * AppApi
 * 沉迷学习不能自拔
 * Describe：
 * Created by 雷小星🍀 on 2017/12/7 9:27.
 */

public class AppApi {

    private static final Interceptor REWRITE_RESPONSE_INTERCEPTOR = chain -> {
        Response originalResponse = chain.proceed(chain.request());
        String cacheControl = originalResponse.header("Cache-Control");
        if (cacheControl == null || cacheControl.contains("no-store") || cacheControl.contains("no-cache") ||
                cacheControl.contains("must-revalidate") || cacheControl.contains("max-age=0")) {
            return originalResponse.newBuilder()
                    .header("Cache-Control", "public, max-age=" + 5000)
                    .build();
        } else {
            return originalResponse;
        }
    };

    private static final Interceptor REWRITE_RESPONSE_INTERCEPTOR_OFFLINE = chain -> {
        Request request = chain.request();
        if (!NetworkUtils.isConnected()) {
            request = request.newBuilder()
                    .header("Cache-Control", "public, only-if-cached")
                    .build();
        }
        return chain.proceed(request);
    };


    private static Api api;
    private static String mApiSign;

    public static Api Api() {
        if (api == null) {
            OkHttpClient okHttpClient = Retrofit2Manager.Companion
                    .getInstance()
                    .getOkHttpClient()
                    .newBuilder()
                    .addInterceptor(chain -> {
                        Request oldRequest = chain.request();

                        HttpUrl httpUrl = oldRequest.url()
                                .newBuilder()
                                .build();

                        Request newRequest = oldRequest.newBuilder()
                                .addHeader("language", "zh_cn")
                                .addHeader("apisign", Constants.getTokenSignApi())
                                .url(httpUrl)
                                .build();
                        return chain.proceed(newRequest);
                    })
                    .addNetworkInterceptor(new StethoInterceptor())
                    .addInterceptor(new TokenInterceptor())
//                    .addNetworkInterceptor(REWRITE_RESPONSE_INTERCEPTOR)
//                    .addInterceptor(REWRITE_RESPONSE_INTERCEPTOR_OFFLINE)
                    .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))//添加网络日志
                    .build();

            Retrofit2Manager.Companion
                    .getInstance()
                    .setOkHttpClient(okHttpClient);//设置新配置的httpClient

//            //设置新的Retrofit
            Retrofit retrofit = new Retrofit.Builder()
                    .baseUrl(Retrofit2Manager.Companion.getInstance().getApiConfigProvider().getApiBaseUrl())
                    .client(okHttpClient)
                    .addConverterFactory(HGsonConverterFactory.create())
                    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                    .build();

            Retrofit2Manager.Companion.getInstance().setRetrofit(retrofit);

            api = Retrofit2Manager.Companion
                    .getInstance()
                    .createApi(Api.class);
        }
        return api;
    }

    /**
     * 置空,使下次请求时重新获取配置
     */
    public static void resetApi() {
        api = null;
    }

    public interface Api {
        /**
         * 发送短信验证码
         *
         * @param mobile 手机号
         */
        @FormUrlEncoded
        @POST("get_pin")
        Observable<BaseResponseEntity<Object>> get_pin(@Field("mobile") String mobile,
                                                       @Field("type") String type);

        /**
         * 注册
         */
        @FormUrlEncoded
        @POST("register")
        Observable<BaseResponseEntity<RegisterEntity>> register(@Field("mobile") String mobile,
                                                                @Field("verify_code") String verify_code,
                                                                @Field("pwd") String pwd,
                                                                @Field("invite_code") String invite_code);

        /**
         * 忘记密码-重置密码
         */
        @FormUrlEncoded
        @POST("forget_pwd")
        Observable<BaseResponseEntity<Object>> setPass(@Field("mobile") String mobile,
                                                       @Field("new_pwd") String pwd,
                                                       @Field("confirm_pwd") String confirm_pwd,
                                                       @Field("verify_code") String yzm);


        /**
         * 推广排行榜
         *
         * @param page 页码
         * @param type 查看类型 day=日 week=周 month=月
         * @return
         */
        @FormUrlEncoded
        @POST("recommend_rank")
        Observable<BaseResponseEntity<List<PromoteRankingEntity>>> recommend_rank(@Field("page") int page,
                                                                                  @Field("type") String type);

        /**
         * 同意支付
         *
         * @param extra_id
         * @param type
         * @param pay_type
         * @return
         */
        @FormUrlEncoded
        @POST("otherpay_accept")
        Observable<BaseResponseEntity<PayResultEntity>> otherpay_accept(@Field("extra_id") String extra_id,
                                                                        @Field("type") String type,
                                                                        @Field("pay_type") String pay_type,
                                                                        @Field("user_pay_pwd") String user_pay_pwd);

        /**
         * 代付 - 拒绝
         *
         * @param msg_id 消息id
         */
        @FormUrlEncoded
        @POST("refuse_other_pay")
        Observable<BaseResponseEntity<Object>> refuse_other_pay(@Field("msg_id") String msg_id);

        /**
         * 转账页面 - 用户余额 & 代付历史
         */
        @POST("transfer_detail")
        Observable<BaseResponseEntity<TransferAccountsEntity>> transfer_detail();

        /**
         * 用户转账
         */
        @FormUrlEncoded
        @POST("transfer")
        Observable<BaseResponseEntity<Object>> transfer(@Field("payee_user_mobile") String payee_user_mobile,
                                                        @Field("wallet_money") String wallet_money,
                                                        @Field("integral_number") String integral_number,
                                                        @Field("remark") String remark,
                                                        @Field("user_pay_pwd") String user_pay_pwd);

        /**
         * 客服信息
         */
        @POST("custom_server")
        Observable<BaseResponseEntity<CustomServerEntity>> custom_server();

        /**
         * 零钱提现
         *
         * @param account
         * @param withdraw_money
         * @return
         */
        @FormUrlEncoded
        @POST("withdraw_apply")
        Observable<BaseResponseEntity<Object>> withdraw_apply(@Field("account") String account,
                                                              @Field("withdraw_money") String withdraw_money,
                                                              @Field("user_pay_pwd") String user_pay_pwd);

        /**
         * 我的分享
         */
        @POST("my_share")
        Observable<BaseResponseEntity<ShareEntity>> my_share();

        /**
         * 账号登录
         *
         * @param mobile 手机号码
         * @param pwd    验证码
         */
        @FormUrlEncoded
        @POST("login")
        Observable<BaseResponseEntity<LoginEntity>> login(@Field("mobile") String mobile,
                                                          @Field("pwd") String pwd);

        /**
         * 手机号登录
         *
         * @param mobile      手机号码
         * @param verify_code 验证码
         */
        @FormUrlEncoded
        @POST("mobile_login")
        Observable<BaseResponseEntity<LoginEntity>> mobile_login(@Field("mobile") String mobile,
                                                                 @Field("verify_code") String verify_code);


        /**
         * 修改密码
         *
         * @param origin_pwd  旧密码
         * @param new_pwd     新密码
         * @param confirm_pwd 确认密码
         * @return {@link Observable<BaseResponseEntity>}
         */
        @FormUrlEncoded
        @POST("modify_pwd")
        Observable<BaseResponseEntity<Object>> modify_pwd(@Field("origin_pwd") String origin_pwd,
                                                          @Field("new_pwd") String new_pwd,
                                                          @Field("confirm_pwd") String confirm_pwd);

        /**
         * 修改支付密码
         *
         * @param new_pwd     新密码
         * @param confirm_pwd 确认新密码
         * @param verify_code 验证码
         * @return {@link Observable<BaseResponseEntity>}
         */
        @FormUrlEncoded
        @POST("modify_paypwd")
        Observable<BaseResponseEntity<Object>> modify_paypwd(@Field("new_pwd") String new_pwd,
                                                             @Field("confirm_pwd") String confirm_pwd,
                                                             @Field("verify_code") String verify_code);

        /**
         * 获取用户资料
         */
        @POST("user_info")
        Observable<BaseResponseEntity<UserEntity>> user_info();

        /**
         * 短token刷新
         */
        @POST("apitoken_refresh")
        Call<BaseResponseEntity<LoginEntity.TokenBean>> apitoken_refresh();

        /**
         * 通过手机号码 获取 头像&姓名
         *
         * @param user_mobile 手机号码
         * @return {@link Observable<BaseResponseEntity>}
         */
        @FormUrlEncoded
        @POST("user_by_mobile")
        Observable<BaseResponseEntity<UserEntity>> user_by_mobile(@Field("user_mobile") String user_mobile);

        /**
         * 反馈意见
         *
         * @param content 反馈内容
         * @return {@link Observable<BaseResponseEntity>}
         */
        @FormUrlEncoded
        @POST("refer_feedback")
        Observable<BaseResponseEntity<Object>> refer_feedback(@Field("content") String content);

        /**
         * 发票助手
         *
         * @return {@link Observable<BaseResponseEntity>}
         */
        @POST("my_inv")
        Observable<BaseResponseEntity<InvoiceEntity>> my_inv();

        /**
         * 我的钱包 & 最近交易
         *
         * @return {@link Observable<BaseResponseEntity>}
         */
        @POST("my_wallet")
        Observable<BaseResponseEntity<PurseEntity>> my_wallet();


        /**
         * 账单查询
         *
         * @param page
         */
        @FormUrlEncoded
        @POST("bill_record")
        Observable<BaseResponseEntity<List<BillEntity>>> bill_record(@Field("page") int page);


        /**
         * 账单详情
         *
         * @param log_id
         * @return
         */
        @FormUrlEncoded
        @POST("bill_detail")
        Observable<BaseResponseEntity<BillEntity>> bill_detail(@Field("log_id") String log_id);

        /**
         * 他人代付 - 历史代付
         */
        @POST("otherpay_history")
        Observable<BaseResponseEntity<List<HistoryPaidEntity>>> otherpay_history();


        /**
         * 他人代付
         */
        @FormUrlEncoded
        @POST("otherpay_apply")
        Observable<BaseResponseEntity<Object>> otherpay_apply(@Field("otherpay_mobile") String otherpay_mobile,
                                                              @Field("otherpay_vip_id") String otherpay_vip_id,
                                                              @Field("otherpay_vip_qty") String otherpay_vip_qty,
                                                              @Field("otherpay_remark") String otherpay_remark);

        /**
         * 会员购买
         *
         * @param vip_id       会员卡id
         * @param buy_qty      购买数量 pay_wa
         * @param buy_type     零钱支付:{@value "pay_wallet"}
         *                     微信支付:{@value "pay_wx"}
         *                     支付宝支付:{@value "pay_alipay"}
         * @param user_pay_pwd
         * @return
         */
        @FormUrlEncoded
        @POST("vip_buy")
        Observable<BaseResponseEntity<PayResultEntity>> vip_buy(@Field("vip_id") String vip_id,
                                                                @Field("buy_qty") String buy_qty,
                                                                @Field("buy_type") String buy_type,
                                                                @Field("user_pay_pwd") String user_pay_pwd);

        /**
         * 我的收藏列表
         *
         * @param page 页码
         */
        @FormUrlEncoded
        @POST("my_collects")
        Observable<BaseResponseEntity<List<MerchantEntity>>> my_collects(@Field("page") int page);

        /**
         * 会员卡列表 & 最近购买会员记录
         */
        @POST("vip_list")
        Observable<BaseResponseEntity<VipEntity>> vip_list();


        /**
         * 会员卡详情
         */
        @FormUrlEncoded
        @POST("vip_detail")
        Observable<BaseResponseEntity<VipDetailEntity>> vip_detail(@Field("vip_id") String vip_id);


        /**
         * 消息列表
         *
         * @param page 页码
         */
        @FormUrlEncoded
        @POST("my_notice")
        Observable<BaseResponseEntity<List<MessageEntity>>> my_notice(@Field("page") int page);


        /**
         * 修改昵称
         *
         * @param newname 昵称
         */
        @FormUrlEncoded
        @POST("name_store")
        Observable<BaseResponseEntity<Object>> name_store(@Field("newname") String newname);

        /**
         * 代付内容
         *
         * @param type 消息类型 1=代付 2=公共消息
         */
        @FormUrlEncoded
        @POST("notice_detail")
        Observable<BaseResponseEntity<PayForDetailEntity>> notice_detail(@Field("type") String type,
                                                                         @Field("msg_id") String msg_id);


        /**
         * 会员卡夹
         */
        @FormUrlEncoded
        @POST("my_vip_rcd")
        Observable<BaseResponseEntity<List<MemberShipCardEntity>>> my_vip_rcd(@Field("page") int page);

        /**
         * 上传图片
         *
         * @param newfile
         * @param type
         * @return
         */
        @Multipart
        @POST("file_store")
        Observable<BaseResponseEntity<FilePathEntity>> file_store(@Part MultipartBody.Part newfile, @Part("type") RequestBody type);


        /**
         * 修改头像
         *
         * @param new_avatar 头像地址
         */
        @FormUrlEncoded
        @POST("avatar_store")
        Observable<BaseResponseEntity<Object>> new_avatar(@Field("new_avatar") String new_avatar);


        /**
         * @param invoice_header          个人抬头
         * @param invoice_company_name    公司户名
         * @param invoice_base_account    基本户账号
         * @param invoice_bank_name       开户行
         * @param invoice_tax_number      税务登记证号
         * @param invoice_register_number 营业执照注册号
         * @param invoice_mobile          电话
         * @param invoice_address         登记地址
         * @return
         */
        @FormUrlEncoded
        @POST("my_inv_store")
        Observable<BaseResponseEntity<Object>> my_inv_store(@Field("invoice_header") String invoice_header,
                                                            @Field("invoice_company_name") String invoice_company_name,
                                                            @Field("invoice_base_account") String invoice_base_account,
                                                            @Field("invoice_bank_name") String invoice_bank_name,
                                                            @Field("invoice_tax_number") String invoice_tax_number,
                                                            @Field("invoice_register_number") String invoice_register_number,
                                                            @Field("invoice_mobile") String invoice_mobile,
                                                            @Field("invoice_address") String invoice_address);

        /**
         * 我的团队
         *
         * @param page 分页
         * @param type 查看类型 user=推荐用户 shop=推荐商家
         */
        @FormUrlEncoded
        @POST("my_team")
        Observable<BaseResponseEntity<MyTeamEntity>> my_team(@Field("page") int page,
                                                             @Field("type") String type);

        //-------------------------------------------------------------------------------------

        /**
         * 首页数据
         *
         * @param page      页码
         * @param longitude 经度
         * @param latitude  纬度
         * @return
         */
        @FormUrlEncoded
        @POST("app_home")
        Observable<BaseResponseEntity<HomeEntity>> getHomeData(@Field("page") String page
                , @Field("longitude") String longitude
                , @Field("latitude") String latitude);

        /**
         * 获取分类列表
         *
         * @param page
         * @return
         */
        @FormUrlEncoded
        @POST("shop_cate")
        Observable<BaseResponseEntity<List<CategoryItemEntity>>> getCategoryListData(@Field("page") String page);

        /**
         * 获取商家详情
         *
         * @param shop_id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_detail")
        Observable<BaseResponseEntity<ShopDetailsEntity>> getShopDetailsData(@Field("shop_id") String shop_id);

        /**
         * 获取商品列表
         *
         * @param shop_id
         * @param page
         * @return
         */
        @FormUrlEncoded
        @POST("shop_goods")
        Observable<BaseResponseEntity<List<ShopGoodsItemEntity>>> getShopGoodsListData(@Field("shop_id") String shop_id
                , @Field("page") String page);

        /**
         * 收藏商家
         *
         * @param shop_id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_collect")
        Observable<BaseResponseEntity<Object>> collectShop(@Field("shop_id") String shop_id);

        /**
         * 商品详情
         *
         * @param good_id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_good_detail")
        Observable<BaseResponseEntity<GoodsDetailsEntity>> getGoodsDetailsData(@Field("good_id") String good_id);

        /***
         * 评论列表
         * @param shop_id
         * @param page
         * @return
         */
        @FormUrlEncoded
        @POST("shop_comments_list")
        Observable<BaseResponseEntity<List<CommentListEntity>>> getCommentListData(@Field("shop_id") String shop_id
                , @Field("page") String page);

        /**
         * 评论详情
         *
         * @param comment_id 评论id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_comment_detail")
        Observable<BaseResponseEntity<CommentDetailsEntity>> getCommentDetailsData(@Field("comment_id") String comment_id);

        /**
         * 附近
         *
         * @param location_name  定位城市
         * @param sort_distance  距离顺序
         * @param user_longitude 经度
         * @param user_latitude  纬度
         * @param page           页码
         * @param sort_new       最新入驻顺序
         * @param sort_comment   评价顺序
         * @return
         */
        @FormUrlEncoded
        @POST("shop_list")
        Observable<BaseResponseEntity<List<NearbyItemEntity>>> getNearbyData(@Field("location_name") String location_name
                , @Field("sort_distance") String sort_distance
                , @Field("user_longitude") String user_longitude
                , @Field("user_latitude") String user_latitude
                , @Field("page") String page
                , @Field("sort_new") String sort_new
                , @Field("sort_comment") String sort_comment);

        /**
         * 商家入驻协议
         */
        @POST("shop_join_agreement")
        Observable<BaseResponseEntity<String>> getEnterProtocolData();


        /**
         * 上传图片
         *
         * @param type    类型
         * @param newfile 图片
         * @return
         */
        @Multipart
        @POST("file_store")
        Observable<BaseResponseEntity<PictureEntity>> uploadPicture(@Part("type") RequestBody type
                , @Part MultipartBody.Part newfile);

        /**
         * 商家入驻
         *
         * @param map
         * @return
         */
        @FormUrlEncoded
        @POST("shop_join")
        Observable<BaseResponseEntity<ShopEnterEntity>> shopEnter(@FieldMap Map<String, String> map);

        /**
         * 3h视频
         *
         * @param page
         * @return
         */
        @FormUrlEncoded
        @POST("videos")
        Observable<BaseResponseEntity<List<ShoppingVideoEntity>>> getShoppingVideoData(@Field("page") String page);

        /**
         * 取消收藏
         *
         * @param shop_id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_collect_cancel")
        Observable<BaseResponseEntity<Object>> cancelCollect(@Field("shop_id") String shop_id);

        /**
         * 热门搜索
         *
         * @return
         */
        @POST("hot_keys")
        Observable<BaseResponseEntity<List<SearchHotEntity>>> getSearchHotData();

        /**
         * 分类商家,搜索分类商家
         *
         * @param location_name  定位城市
         * @param sort_distance  距离顺序
         * @param user_longitude 经度
         * @param user_latitude  纬度
         * @param page           页码
         * @param sort_new       最新入驻顺序
         * @param sort_comment   评价顺序
         * @param shop_name      商家名称
         * @param shop_cate_id   分类id
         * @return
         */
        @FormUrlEncoded
        @POST("shop_list")
        Observable<BaseResponseEntity<List<NearbyItemEntity>>> getCategoryShopData(@Field("location_name") String location_name
                , @Field("sort_distance") String sort_distance
                , @Field("user_longitude") String user_longitude
                , @Field("user_latitude") String user_latitude
                , @Field("page") String page
                , @Field("sort_new") String sort_new
                , @Field("sort_comment") String sort_comment
                , @Field("shop_name") String shop_name
                , @Field("shop_cate_id") String shop_cate_id);

        /**
         * 首页搜索结果
         *
         * @param location_name  定位城市
         * @param user_longitude 经度
         * @param user_latitude  纬度
         * @param shop_name      商家名称
         * @return
         */
        @FormUrlEncoded
        @POST("shop_list")
        Observable<BaseResponseEntity<List<NearbyItemEntity>>> getHomeSearchResultData(@Field("location_name") String location_name
                , @Field("user_longitude") String user_longitude
                , @Field("user_latitude") String user_latitude
                , @Field("shop_name") String shop_name);

        /***
         * 扫一扫获取
         * @param shop_number 扫描内容
         * @return
         */
        @FormUrlEncoded
        @POST("scan_shop")
        Observable<BaseResponseEntity<PaymentCodeEntity>> getScanCodeData(@Field("shop_number") String shop_number);

        /**
         * 获取PayToken
         *
         * @return
         */
        @POST("refresh_paytoken")
        Observable<BaseResponseEntity<String>> getPayToken();

        /**
         * 支付评价
         *
         * @param order_sn        订单号
         * @param comment_score   评分
         * @param comment_content 内容
         * @param comment_imgs    图片
         * @return
         */
        @FormUrlEncoded
        @POST("order_comment")
        Observable<BaseResponseEntity<Object>> submitComment(@Field("order_sn") String order_sn
                , @Field("comment_score") String comment_score
                , @Field("comment_content") String comment_content
                , @Field("comment_imgs") String comment_imgs);

        /**
         * 付款说明
         *
         * @return
         */
        @POST("pay_introduction")
        Observable<BaseResponseEntity<String>> getPayInstructionsData();

        /**
         * 用户支付设置状态
         *
         * @return
         */
        @POST("pay_setting")
        Observable<BaseResponseEntity<CodePaySettingEntity>> getCodePaySettingStatus();

        /**
         * 保存用户支付设置状态
         *
         * @param pay_set_type
         * @param pay_set_wallet_rate
         * @param pay_set_integral_rate
         * @return
         */
        @FormUrlEncoded
        @POST("pay_setting_modify")
        Observable<BaseResponseEntity<Object>> saveCodePaySettingStatus(@Field("pay_set_type") String pay_set_type
                , @Field("pay_set_wallet_rate") String pay_set_wallet_rate
                , @Field("pay_set_integral_rate") String pay_set_integral_rate);

        /**
         * 商家付款(零钱支付)
         *
         * @param shop_id              商家id
         * @param pay_amount           支付金额
         * @param pay_type             支付类型
         * @param user_pay_pwd         支付密码
         * @param user_wallet_amount   零钱
         * @param user_integral_amount 积分
         * @return
         */
        @FormUrlEncoded
        @POST("shop_pay")
        Observable<BaseResponseEntity<LoosePaymentEntity>> shopLoosePayment(@Field("shop_id") String shop_id
                , @Field("pay_amount") String pay_amount
                , @Field("pay_type") String pay_type
                , @Field("user_pay_pwd") String user_pay_pwd
                , @Field("user_wallet_amount") String user_wallet_amount
                , @Field("user_integral_amount") String user_integral_amount);

        /**
         * 检测是否设置了支付密码
         *
         * @return
         */
        @POST("check_paypwd")
        Observable<BaseResponseEntity<CheckPwdEntity>> checkPwd();

        /**
         * 支付结果
         *
         * @param record_sn
         * @return
         */
        @FormUrlEncoded
        @POST("pay_result")
        Observable<BaseResponseEntity<PayResultEntity>> getPayResultData(@Field("record_sn") String record_sn);

        /**
         * 商家付款 他人支付
         *
         * @param otherpay_mobile  手机号
         * @param otherpay_shop_id 二维码id
         * @param otherpay_amount  支付金额
         * @return
         */
        @FormUrlEncoded
        @POST("otherpay_apply_shop")
        Observable<BaseResponseEntity<Object>> shopOtherPay(@Field("otherpay_mobile") String otherpay_mobile
                , @Field("otherpay_shop_id") String otherpay_shop_id
                , @Field("otherpay_amount") String otherpay_amount);

        /**
         * 购买协议
         * @return
         */
        @POST("recharge_protocol")
        Observable<BaseResponseEntity<String>> getBuyAgreement();

    }
}
